/*
** bsr.c for newin-malloc-read-only in /home/leroy_v/newin-malloc-read-only
**
** Made by leroy_v
** Login  <leroy_v@epitech.eu>
**
** Started on  Tue Feb 05 17:21:05 2013 vincent leroy
** Last update Tue Feb 05 18:11:55 2013 vincent leroy
*/

#include "malloc.h"

long bsr(long a)
{
    long b;
#ifdef __x86_64__
    asm("bsrq %1, %0" : "=r" (b) : "r" (a));
#elif __i386__
    asm("bsrl %1, %0" : "=r" (b) : "r" (a));
#else
#error Unknown architecture
#endif
    return (1L << (b + 1));
}
